<!DCOTYPE  html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>报表管理</title>
        <link rel="stylesheet" href="/css/theme/font-awesome.min.css" type="text/css" />
        <link rel="stylesheet" href="/css/theme/bootstrap.min.css" type="text/css" />
        <link rel="stylesheet" href="/javascript/theme/libs/jquery-easyui-1.4/themes/default/easyui.css" type="text/css" />
        <link rel="stylesheet" href="/css/theme/App.css" type="text/css" />
        <link rel="stylesheet" href="/css/theme/custom.css" type="text/css" />
        <link rel="stylesheet" href="/css/theme/report/stylesheets/report.css" type="text/css" />
        <script src="/javascript/theme/libs/jquery-1.9.1.min.js"></script>
        <script src="/javascript/theme/libs/jquery-easyui-1.4/jquery.easyui.min.js"></script>
        <script src="/javascript/theme/libs/bootstrap.min.js"></script>
        <script src="/javascript/theme/App.js"></script>
        <script type="text/javascript" src="/javascript/My97DatePicker/WdatePicker.js"></script>
        <script type="text/javascript" src="/javascript/report/FusionCharts.js"></script>
        <style type="text/css">
            .alink {
            text-decoration:underline;
            color:#0000CC;
            }
            .alinkClicked {
            color:#0000CC;
            }
            #cates,#locals,#cateClean,#localClean{
            display:none;
            }
            .table tbody>tr>td {
            word-break: break-all;
            word-wrap: break-word;         
            vertical-align: middle;         
            }
            .comboxtootip {			  
			    border: 0px solid #ccc;
			    border-color: #95B8E7;
			    overflow: auto;
			    box-sizing: border-box;
			    text-align: left;
			    font-family: '微软雅黑';
			    height: 150px;
			}
			.combobox-item {
				/* display:table-row; 
				overflow: auto;  */
			    font-size: 15px;
			    font-family: inherit;			    			  
			    height:30px;
			    width: 170px;	
			    text-align:left;	
			    cursor: pointer;	 
			    padding-top: 8px;        
			}
			.check{
			    background-color: gray;
			    border-top-left-radius: 4px;
			    border-radius: 4px;	  
			    color:white; 
			}
        </style>
    </head>

    <body>
    <div id="content" style="OVERFLOW-X:yes;OVERFLOW-Y:auto">
    <!-- 添加 -->
         <div class="mail" id="indexsend" style="display:none;padding: 10px 10px 10px 10px;height:330px;">
            <div class="mail-title">添加数据<span><a href="javascript:void(0);" class="close-mail" onclick="closethis()" style="padding-left: 5px;padding-top: 5px;">关闭</a></span></div>
               
                <div class="form-group" style="padding-left: 65px;padding-top: 30px;">
                    <label class="col-md-2" style="font-size: 16px;color: #000000;margin-left: -17px;">表&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名：</label>
                    <div class="col-md-2">
                      <input style="width:200px" type="text" id="add_tableName" name="add_tableName" class="form-control"/>
                    </div>
                </div>              
                 </br>
                <div class="form-group" style="padding-left: 49px;padding-top: 14px;">
                    <label class="col-md-2" style="font-size: 16px;color: #000000;">一级类别：</label>
                    <div class="col-md-2">
							
		                <div class="dropdown clearfix" id="add_cate1_div">
							      <button onclick="showSelect(this,'cate1')" class="btn btn-default dropdown-toggle" type="button"   aria-haspopup="true" aria-expanded="false" style="width: 200px; height: 25px;cursor: pointer; ">
							      <input id="add_cate1_text" style="width:200px;margin-left: -12px;text-align: left;margin-top: -9px;height:25px" type="text" value="$cate1List.get(0)" class="btn btn-default dropdown-toggle" disabled>						       
							      <span  class="caret" style="position: relative;margin-left: -20px;cursor: pointer;margin-top: -8px;"></span>					     					     					     
							      </button>
						</div>
						<div  id="add_cate1_combox" style="  position: absolute;width: 200px;height:188px;border: 1px solid #ccc;border-color: #95B8E7;z-index: 999;background-color: white;display:none;">
		                                <input type="text" onkeyup="searchItem(this,'selectCate1')"  class="input-block-level form-control" style="margin-left: 13px;width:170px;margin-top: 5px">        
			                            <div  class="comboxtootip" style="width: 185px; margin-top: 10px;margin-left: 13px;">
                                                  #foreach($rs in $cate1List)		
			    								     <div class="combobox-item" onclick="selectCate1(this)" onmouseover="changeClass(this,0)" onmouseout="changeClass(this,1)">$!rs</div>
								                  #end 		                                                            
		                               </div>   
		                               <div   class="comboxtootip" style="width: 185px; margin-top: 10px;margin-left: 13px;display:none">                                                	                                                            
		                                         	
		                               </div>
		                </div>
		           
				    
				</div> 
			                                       
                </div>
                </br>
                <div class="form-group" style="padding-left: 49px;padding-top: 14px;">
                    <label class="col-md-2" style="font-size: 16px;color: #000000;">二级类别：</label>
       
				   <div class="col-md-2">
							
		                <div class="dropdown clearfix" id="add_cate2_div" >
							      <button  onclick="showSelect(this,'cate2')" class="btn btn-default dropdown-toggle" type="button"   aria-haspopup="true" aria-expanded="false" style="width: 200px; height: 25px;cursor: pointer;">
							      <input id="add_cate2_text" style="width:200px;margin-left: -12px;text-align: left;margin-top: -9px;height:25px" type="text" value="$cate2List.get(0)" class="btn btn-default dropdown-toggle" disabled>						       
							      <span   class="caret" style="position: relative;margin-left: -20px;cursor: pointer;margin-top: -8px;"></span>					     					     					     
							      </button>
						</div>
						<div  id="add_cate2_combox" style=" position: absolute;width: 200px;height:188px;border: 1px solid #ccc;border-color: #95B8E7;z-index: 999;background-color: white;display:none;">
		                               <input type="text" onkeyup="searchItem(this,'selectCate2')" class="input-block-level form-control" style="margin-left: 13px;width:170px;margin-top: 5px">        
			                            <div  class="comboxtootip" style="width: 185px; margin-top: 10px;margin-left: 13px;">
                                                  #foreach($rs in $cate2List)		
			    								     <div class="combobox-item" onclick="selectCate2(this)" onmouseover="changeClass(this,0)" onmouseout="changeClass(this,1)">$!rs</div>
								                  #end 
		                                                            
		                               </div>   
		                               <div   class="comboxtootip" style="width: 185px; margin-top: 10px;margin-left: 13px;display:none">                                                	                                                            		                                         
		                               </div>
		                </div>
		           
				    
				    </div> 
                </div>
                </br>
                <div class="form-group" style="padding-left: 65px;padding-top: 14px;">
                    <label class="col-md-2" style="font-size: 16px;color: #000000;margin-left: -17px;">指&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;标：</label>
				     <div class="col-md-2">
							
		                <div class="dropdown clearfix" id="add_indexName_div">
							      <button onclick="showSelect(this,'indexName')" class="btn btn-default dropdown-toggle" type="button"   aria-haspopup="true" aria-expanded="false" style="width: 200px; height: 25px;cursor: pointer;">
							      <input id="add_indexName_text" style="width:200px;margin-left: -12px;text-align: left;margin-top: -9px;height:25px" type="text" value="$indexNameList.get(0)" class="btn btn-default dropdown-toggle" disabled>						       
							      <span   class="caret" style="position: relative;margin-left: -20px;cursor: pointer;margin-top: -8px;"></span>					     					     					     
							      </button>
						</div>
						<div  id="add_indexName_combox" style=" position: absolute;width: 200px;height:188px;border: 1px solid #ccc;border-color: #95B8E7;z-index: 999;background-color: white;display:none;">
		                               <input type="text" onkeyup="searchItem(this,'selectIndexName')" class="input-block-level form-control" style="margin-left: 13px;width:170px;margin-top: 5px">        
			                            <div  class="comboxtootip" style="width: 185px; margin-top: 10px;margin-left: 13px;">
                                                  #foreach($rs in $indexNameList)		
			    								     <div class="combobox-item " onclick="selectIndexName(this)" onmouseover="changeClass(this,0)" onmouseout="changeClass(this,1)">$!rs</div>
								                  #end 
		                                                           
		                               </div>  
		                               <div   class="comboxtootip" style="width: 185px; margin-top: 10px;margin-left: 13px;display:none">                                                	                                                            
		                                          
		                               </div> 
		                </div>
		           
				    
				   </div> 
                </div>
                </br>
                  <div class="form-group" style="padding-left: 48px;padding-top: 14px;">
                    <label class="col-md-2" style="font-size: 16px;color: #000000;">报表信息：</label>
                    <div class="col-md-2">
                      <input style="width:200px" type="text" id="add_tableInfo" name="add_tableInfo" class="form-control"/>
                    </div>
                  </div>
                </br>
                <div class="form-group" style="padding-left: 47px;padding-top: 14px;">
                    <label class="col-md-2" style="font-size: 16px;color: #000000;">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注：</label>
                    <div class="col-md-2">
                      <textarea id="add_remark" class="form-control" rows="3" style="width:250px"></textarea>
                    </div>
                </div>
                </br>
                </br>
                </br>
                <div class="form-group" style="padding-left: 200px;padding-top: 28px;">
                    <button type="button" id="subIndex" name ="subIndex" onclick="IndexSubsend()" class="btn btn-info btn-xs">确认添加</button>
                </div>
        </div>
        <div class="panelhidden-bg" id="panelclose"></div>
       
         <!-- 修改 -->
         <div class="mail" id="indexsend1" style="display:none;padding: 10px 10px 10px 10px;height:350px;width:550px">
            <div class="mail-title">修改数据<span><a href="javascript:void(0);" class="close-mail" onclick="closethis()" style="padding-left: 5px;padding-top: 5px;">关闭</a></span></div>
                
                </br>
                <div class="form-group" style="padding-left: 34px;padding-top: 30px;">
                    <label class="col-md-2" style="font-size: 16px;color: #000000;">指&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;标：</label>
                    <div class="col-md-2">
                    <h3 id="modify_indexName"></h3>
                    </div>
                </div>
                 </br>
                <div class="form-group" style="padding-left: 34px;padding-top: 10px;">
                    <label class="col-md-2" style="font-size: 16px;color: #000000;">一级类别：</label>
                    <div class="col-md-2">
                      <h3 id="modify_cate1"></h3>
                    </div>
                </div>
                </br>
                <div class="form-group" style="padding-left: 34px;padding-top: 10px;">
                    <label class="col-md-2" style="font-size: 16px;color: #000000;">二级类别：</label>
                    <div class="col-md-2">
                      <h3 id="modify_cate2"></h3>
                    </div>
                </div>
                </br>
                <div class="form-group" style="padding-left: 34px;padding-top: 10px;">
                    <label class="col-md-2" style="font-size: 16px;color: #000000;">表&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名：</label>
                    <!-- <div class="col-md-2">
                      <h3 id="modify_tableName"></h3>
                    </div> -->
                     <div class="col-md-2">
                      <input style="width:250px" type="text" id="modify_tableName" name="modify_tableInfo" class="form-control"/>
                    </div>
                </div>
                </br>
                <div class="form-group" style="padding-left: 34px;padding-top: 10px;">
                    <label class="col-md-2" style="font-size: 16px;color: #000000;">报表信息：</label>
                    <div class="col-md-2">
                      <input style="width:250px" type="text" id="modify_tableInfo" name="modify_tableInfo" class="form-control"/>
                    </div>
                </div>
                </br>
                </br>
                <div class="form-group" style="padding-left: 34px;padding-top: 14px;">
                    <label class="col-md-2" style="font-size: 16px;color: #000000;">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注：</label>
                    <div class="col-md-2">
                      <textarea id="modify_remark" class="form-control" rows="3" style="width:250px"></textarea>
                    </div>
                </div>
                </br>
                <div class="form-group" style="padding-left: 240px;padding-top: 50px;">
                    <button type="button" id="subIndex" name ="subIndex" onclick="sendModify()" class="btn btn-info btn-xs">确认修改</button>
                </div>
        </div>
        
        
    
        <div id="content-container">
            <form action="/indexManager/report/search" class="form-horizontal" name="searchform" role="form" method="post">
            <div class="portlet">
                <div class="portlet-header">
                    <h3>
                          <i class="fa fa-tasks"></i>
                                                                                           报表属性管理&nbsp;&nbsp;&nbsp;                                                                                    
                     </h3>
                     
                </div>

            <div class="portlet-content">
  
                <div class="form-group" style="margin-top: 10px;>
                                                           
                          
                        <div class="form-group" id="selectcont2" >
						    <label class="col-md-2" style="margin-left:18px;">&nbsp;&nbsp;指&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;标：
						    </label>
						    <div class="col-md-2" style="margin-left:-7px;">
						    <input type="text" class="form-control" style="width:200px" name="indexName"  id="indexName" rename="指标英文名" value="$!indexName1">
						    </div>
						    
						</div>
						<div class="form-group" id="selectcont3" style="margin-top: 10px;">
						    <label class="col-md-2" style="margin-left: 15px;">&nbsp;&nbsp;报表信息: 
						    </label>
						    <div class="col-md-2">
						    <input type="text" class="form-control" style="width:200px" name="tableInfo" id="tableInfo" rename="指标中文名"  value="$!tableInfo1">
						    </div>&nbsp;
						    
						    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						    <input type="button" class="btn btn-primary btn-xs" id="search_button" onclick="searchdata()" value="查询">  
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <input type="button" class="btn btn-primary btn-xs" id="IndexSubsend" onclick="indexsub()" value="添加">                                        

                </div>

                <div class="form-group">
                     <div > &nbsp;&nbsp;&nbsp;&nbsp;</div>
                </div>
               

                <textarea style="width:100px;height:20px"  hidden="hidden"  name="selecttype" id="selecttype" value="$!{selecttype}" >$!{selecttype}</textarea>  

              </form>
            </div><!--portlet-content-->
            </div><!--portlet-->
#if($rsList)
          <div class="portlet">
    <div class="portlet-header">
        <h3>
            <i class="fa fa-hand-o-up"></i>
            查询结果
        </h3>
        <input type='hidden' id='curPage' #if($pageindex) value="$pageindex" #else value="0" #end/>
    </div>
        <div class="portlet-content">
            <div class="table-responsive">
                <table class="table table-striped table-bordered table-hover" id="wordtable" data-provide="datatable" data-display-rows="20" >
                    <thead>
                        <tr>                         
                            <th  style="text-align:center;width:220px;">表名</th>
                            <th  style="text-align:center;width:220px;">指标</th>
                            <th  style="text-align:center;width:220px;">报表信息</th>
                            <th  style="text-align:center;width:100px;">一级类别</th>    
                            <th  style="text-align:center;width:100px;">二级类别</th>   
                            <th  style="text-align:center;width:150px;">备 注</th>  
                            <th  style="text-align:center;width:50px;"></th>           
                        </tr>
                    </thead>
                    
                    <tbody>
                        #foreach($rs in $rsList)
                            <tr  align="center" >                                               
                                <td style="text-align:center;">$!rs.tableName</td>
                                <td style="text-align:center;">$!rs.indexName</td>
                                <td style="text-align:center;">$!rs.tableInfo</td> 
                                <td style="text-align:center;">$!rs.cate1</td>
                                <td style="text-align:center;">$!rs.cate2</td>
                                <td style="text-align:center;">$!rs.remark</td>
                                <td style="text-align:center;"><input type="hidden" value="$!rs.id"><input type="button" class="btn btn-primary btn-xs" onclick="modifyData(this)" value="修改"> <!-- <input type="button" class="btn btn-primary btn-xs" onclick="deleteData(this)" value="失效"> --></td>
                            </tr>
                        #end												
                    </tbody>
                </table>
                <div class="row dt-rb">
                            #parse("/views/default/newpage.vm")                                               
                                 #pagenew($pList "/indexManager/report/search?#page#&$paramurl")
                                 
                            
                </div>	
            </div>
        </div>
</div>
#end


</div>



<script >
	
    var tableInfoInnit = "";
    var remarkInnit = "";
    //设置修改时的数据
	function modifyData(obj){
	
		var $tds = $(obj).parent().parent().children();
		var tableName = $tds.eq(0).text();
		var indexName = $tds.eq(1).text();
		var tableInfo = $tds.eq(2).text();
		var cate1 = $tds.eq(3).text();
		var cate2 = $tds.eq(4).text();	
		var remark = $tds.eq(5).text();
		//修改前的数据
		id = $(obj).prev().get(0).value;
		tableNameInnit = tableName;
		tableInfoInnit = tableInfo;
		remarkInnit = remark;
		
		
		$("#modify_tableName").val(tableName);
		$("#modify_indexName").text(indexName);
		$("#modify_cate1").text(cate1);
		$("#modify_cate2").text(cate2);
		$("#modify_tableInfo").val(tableInfo);
		$("#modify_remark").val(remark);
		$('#indexsend1').show();
        $('#panelclose').show();
	}

    function deleteData(obj){
    		
    	var $tds = $(obj).parent().parent().children();
		var indexName = $tds.eq(0).text();
    	//表格行数，判断表格的数据是否只有一条
    	var rows = $("#wordtable").children().size();
    	jQuery.ajax({
            url:"$!{__beat.server.contextPath}/indexManager/modify/delete",
            type:"post",
            async:true,
            data:{"indexName":indexName},
                   success:function(data){
                       if(data == "error"){
                           alert("操作失败！");
                       }else{
                    	   var paramurl2 ="&indexInfo="+$("#indexInfo").val()+"&indexName="+$("#indexName").val();                    	   
                           alert("操作成功！");
                           if(rows==2 && ($('#curPage').val()==getEndPage())&&getEndPage()>1){
                        	   var pageindex = $('#curPage').val()-1;
                        	   window.location.href="$!{__beat.server.contextPath}/indexManager/search?pageindex=" +pageindex+paramurl2;
                           } else{
                        	   
                               window.location.href="$!{__beat.server.contextPath}/indexManager/search?pageindex=" + $('#curPage').val()+paramurl2;                                       
                           }
                       }
                   }
               });
    } 

function searchdata(){
	var indexName = $("#indexName").val();
	var indexInfo = $("#indexInfo").val();
	if(indexName == "" && indexInfo == ""){
		alert("请输入搜索内容！");
		return;
	} 
	searchform.submit();  	
}

 function closethis(){
    $('.mail').hide();
    $('.panelhidden-bg').hide();
}
   function IndexSubsend(){
    
	    var tableName = $("#add_tableName").val();
		var indexName = $("#add_indexName_text").val();
		var cate1 = $("#add_cate1_text").val();		
		var cate2 = $("#add_cate2_text").val();
		var tableInfo = $("#add_tableInfo").val();
		var remark = $("#add_remark").val();	
	    
	    if(tableName==""){
			alert("请输入表名！");
			return;
		} else if(tableInfo==""){
			alert("请输入报表信息！");
			return ;
		}  
		
		
	     jQuery.ajax({
	        url:"$!{__beat.server.contextPath}/indexManager/report/add",
	        type:"post",
	        async:true,
	        data:{"tableName":tableName,"indexName":indexName,"cate1":cate1,"cate2":cate2,"tableInfo":tableInfo,"remark":remark},
	               success:function(data){
	                   if(data == "error"){
	                       alert("操作失败！");
	                   }else {	                       
	                       alert("添加成功！");
                           $('#indexsend').hide();
                           $('.panelhidden-bg').hide();	                                 
	                   }       
		}
	           }); 
	     
} 
  
function sendModify(){
	
	var tableName = $("#modify_tableName").val();
	var tableInfo = $("#modify_tableInfo").val();
	var remark = $("#modify_remark").val();

	
	if(tableInfo==tableInfoInnit && remark==remarkInnit && tableNameInnit==tableName){		
		alert("您没有修改任何信息!");
		return;
	}
	
	jQuery.ajax({
        url:"$!{__beat.server.contextPath}/indexManager/report/modify/update",
        type:"post",
        async:true,
        data:{"tableName":tableName,"tableInfo":tableInfo,"remark":remark,"id":id},
               success:function(data){
            	   $('#indexsend1').hide();
                   $('.panelhidden-bg').hide();
                   if(data == "error"){
                       alert("操作失败！");
                   }else{
                       var paramurl2 ="&tableInfo="+$("#tableInfo").val()+"&indexName="+$("#indexName").val();                      
                       alert("修改成功");
                       window.location.href="$!{__beat.server.contextPath}/indexManager/report/search?pageindex=" + $('#curPage').val()+paramurl2;             
                   }
               }
           });
      
    
} 

function getEndPage(){
	var $li = $(".pagination li");
	var endPage = 1;
	for(var i=$li.size()-1;i>=0;i--){
		endPage = parseInt($li.eq(i).text());
		if(!isNaN(endPage)){
			return endPage;
		}
	}
	return endPage;
	
}

function indexsub(){
	$("#add_tableName").val("");
    $("#add_tableInfo").val("");
	$("#add_remark").val("");	
    $('#indexsend').show();
    $('#panelclose').show();    
} 


function showSelect(obj,cate){

	var $cate1 = $("#add_cate1_combox");
	var $cate2 = $("#add_cate2_combox");
	var $indexName = $("#add_indexName_combox");
	
	$(obj).parent().next().children().eq(2).get(0).style.display = "none";
	$(obj).parent().next().children().eq(0).val("");
	
	if(cate == "cate1"){
		$($cate2).get(0).style.display = "none";
		$($indexName).get(0).style.display = "none";
	}else if(cate == "cate2"){
		$($cate1).get(0).style.display = "none";
		$($indexName).get(0).style.display = "none";
	}else{
		$($cate1).get(0).style.display = "none";
		$($cate2).get(0).style.display = "none";
	}
    $(obj).parent().next().children().eq(1).get(0).style.display = "block";
	
	var $div = $(obj).parent().next();
	if($div.get(0).style.display == "none"){
		$div.get(0).style.display = "block";
		return ;
	}
	$div.get(0).style.display = "none"; 
		
}

   function selectCate1(obj){
	var cate1 = $(obj).text();
	
	jQuery.ajax({
        url:"$!{__beat.server.contextPath}/indexManager/report/getType/cate1",
        type:"post",     
        async:true,
        data:{"cate1":cate1},
               success:function(data){           	  
                   if(data == "error"){
                       alert("操作失败！");
                   }else{  
                	   var $boxItem1 = '';
                	   var $boxItem2 = '';
                       $.each(data.cate2List,function(index,value){
                    	   $boxItem1 += '<div class="combobox-item" onclick="selectCate2(this)" onmouseover="changeClass(this,0)" onmouseout="changeClass(this,1)">'+value+'</div>';
                       });  
                       $.each(data.indexNameList,function(index,value){
                    	   $boxItem2 += '<div class="combobox-item" onclick="selectIndexName(this)" onmouseover="changeClass(this,0)" onmouseout="changeClass(this,1)">'+value+'</div>';
                       });

                        $("#add_cate2_combox").children().eq(1).empty();
                        $("#add_cate2_combox").children().eq(1).append($boxItem1);
                       
                        $("#add_indexName_combox").children().eq(1).empty();
                        $("#add_indexName_combox").children().eq(1).append($boxItem2);  
                        $(obj).parent().parent().get(0).style.display = "none";

                        $("#add_cate1_text").val(cate1);
                        $("#add_cate2_text").val(data.cate2List[0]);
                        $("#add_indexName_text").val(data.indexNameList[0]);
                                              
                                  
                   }
               }
           });
} 
   
   function selectCate2(obj){
	   var cate1 = $("#add_cate1_text").val();
	   var cate2 = $(obj).text();
      
	   
		jQuery.ajax({
	        url:"$!{__beat.server.contextPath}/indexManager/report/getType/cate2",
	        type:"post",     
	        async:true,
	        data:{"cate1":cate1,"cate2":cate2},
	               success:function(data){           	  
	                   if(data == "error"){
	                       alert("操作失败！");
	                   }else{  
	                	   var $boxItem1 = '';        	  
	                       $.each(data.indexNameList,function(index,value){
	                    	   $boxItem1 += '<div class="combobox-item" onclick="selectIndexName(this)" onmouseover="changeClass(this,0)" onmouseout="changeClass(this,1)">'+value+'</div>';
	                       });  
         
	                        $("#add_indexName_combox").children().eq(1).empty();
	                        $("#add_indexName_combox").children().eq(1).append($boxItem1);  
	                        $(obj).parent().parent().get(0).style.display = "none";

	                        $("#add_cate1_text").val(cate1);
	                        $("#add_cate2_text").val(cate2);
	                        $("#add_indexName_text").val(data.indexNameList[0]);
	                                  
	                   }
	               }
	           });
   }
  
function searchItem(obj,functionName){
	//搜索词
	var text = $(obj).val();
	var $items = $(obj).next().children();
	var $showItems = $(obj).next().next();
	$showItems.empty();
	var $div = '';
	$.each($items,function(index,element){
		//没有匹配到的item
		 if($(element).text().match(text)!=null){                        
             $div += '<div class="combobox-item" onclick="'+functionName+'(this)" onmouseover="changeClass(this,0)" onmouseout="changeClass(this,1)"><i  style="position: relative;margin-top: 8px;font-size: 16px;">'+$(element).html()+'</div>';
			  
		 }
	});
	$(obj).next().get(0).style.display = 'none';
	$showItems.get(0).style.display = "block";	 
	$showItems.append($div);
}  

function selectIndexName(obj){
	$("#add_indexName_text").val($(obj).text());
	$(obj).parent().parent().get(0).style.display = "none";
}

//0:代表选中 ，1：代表普通
function changeClass(obj,type){
	if(type==0){
		$(obj).addClass("check");
	}else{
		$(obj).removeClass("check");
	}
}

$("#indexsend").click(function(e) {
    
  
     if(e.target.tagName != "BUTTON") {           
        $("#add_cate1_combox").hide();
        $("#add_cate2_combox").hide();
        $("#add_indexName_combox").hide();
        
    } 
});  
 
</script>
 
</body>
</html>